﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.Composition;
using COFE.Core.Profile;
using COFE.Core.Lister;
using COFE.Core.Logger;
using System.Diagnostics;
using COFE.Core.EntryType;
using COFE.Core.Utils;
using COFE.Core.Filter;
using COFE.Core.Entry;
using System.IO;

namespace COFE.Core.Plugin
{
    [Export(typeof(IPlugin))]
    public class COFEPlugin : COFEPluginBase, ICOFEPlugin
    {
        #region Constructor

        static COFEPlugin()
        {
        }

        public COFEPlugin()
            : base(PluginBase.Priority_COFE)
        {
            _directoryListerFactories.Add(new ProfileRootDirectoryListerFactory(
                ProfileRootDirectoryLister.ProfileRootFactoryKey));
            
            registerProperties<InternalProperties>();
            registerProperties<FileSystemInfoProperties>();
            registerProperties<FileInfoProperties>();
            registerProperties<DirectoryInfoProperties>();
            registerProperties<IconProperties>();
            registerProperties<EventLogProperties>();

            _entryFilters.AddRange(
                new Type[] {
                    typeof(FileNameEntryFilter),
                    typeof(FileTypeEntryFilter),
                    typeof(GuidEntryFilter),
                    typeof(RootEntryFilter)
                });

            _lookupFilters.AddRange(
                new Type[] {
                    typeof(PaginateOptionFilter),
                    typeof(SortResultOptionFilter),
                    typeof(SearchOptionOptionFilter),
                    typeof(SearchSourceOptionFilter)
                });                   

            _entryFilterIconProviders.AddRange(new Tuple<Type, IEntryTypeIconProvider>[]
            {                
                FilterUtils2.Tuple(typeof(FileTypeEntryFilter), ResourceIconProvider.Instance)
            });

            _eventLogPropertyProviders.Add(new FileSystemEventLogPropertyProvider());

            VolumeRegistrar = new VolumeRegistrar();
            SecondaryPropertyProviderManager = new SecondaryPropertyProviderManager();
            PropertyDictionary = new PropertyDictionary();
            PathParser = new BasicPathParser();
            EntryConstructor = new EntryConstructor();
            EntryListRegistrar = new EntryListRegistrar();
            UserProfileManager = new NoUserManagementUserProfileManager();
            FileSystemEventDispatcher = new FileSystemEventDispatcher();
            FileSystemEventLogger = new EventLogger<FileSystemEventArgsExA>();
            EntryTypeDictionary = new EntryTypeDictionary(new EntryIconExtractor(), new EntryTypeFilterGenerator());
        }

        #endregion

        #region Methods

        #endregion

        #region Data

        #endregion

        #region Public Properties


        #endregion


        
    }
}
